package com.landleaf.smarthome.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.provider.Settings;
import android.util.Log;



/**
 * 设备信息工具类
 */
public class DeviceInfoUtil {

    private static final String TAG = DeviceInfoUtil.class.getSimpleName();

    private static final String DEFAULT_DEV_ID = "default";

    private DeviceInfoUtil() {

    }


    //获取设备id（ANDROID_ID）
    public static String getDeviceId(Context context) {
        //根据mac地址获取信息不靠谱
        @SuppressLint("HardwareIds")
        String devId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
        if (devId == null){
            devId = DEFAULT_DEV_ID;
        }
        Log.d(TAG, "The Device Id is:" + devId);
        return devId;
    }
}
